--- a/m4/fd_passing.m4
+++ b/m4/fd_passing.m4
@@ -8,7 +8,7 @@ AC_DEFUN([DOVECOT_FD_PASSING], [
         CFLAGS="$CFLAGS -DBUGGY_CMSG_MACROS"
       fi
     
-      AC_TRY_RUN([
+      AC_TRY_LINK([
         #include <sys/types.h>
         #include <sys/socket.h>
         #include <sys/wait.h>
@@ -16,7 +16,7 @@ AC_DEFUN([DOVECOT_FD_PASSING], [
         #include <unistd.h>
         #include <fcntl.h>
         #include "fdpass.h"
-        
+      ], [
 	static
         int nopen(void)
         {
--- a/m4/glibc.m4
+++ b/m4/glibc.m4
@@ -17,7 +17,7 @@ AC_DEFUN([DOVECOT_GLIBC], [
   dnl * Old glibcs have broken posix_fallocate(). Make sure not to use it.
   dnl * It may also be broken in AIX.
   AC_CACHE_CHECK([whether posix_fallocate() works],i_cv_posix_fallocate_works,[
-    AC_TRY_RUN([
+    AC_TRY_LINK([
       #define _XOPEN_SOURCE 600
       #include <stdio.h>
       #include <stdlib.h>
@@ -26,6 +26,7 @@ AC_DEFUN([DOVECOT_GLIBC], [
       #if defined(__GLIBC__) && (__GLIBC__ < 2 || __GLIBC_MINOR__ < 7)
         possibly broken posix_fallocate
       #endif
+    ], [
       int main() {
         int fd = creat("conftest.temp", 0600);
         int ret;
--- a/m4/ioloop.m4
+++ b/m4/ioloop.m4
@@ -4,9 +4,9 @@ AC_DEFUN([DOVECOT_IOLOOP], [
   
   if test "$ioloop" = "best" || test "$ioloop" = "epoll"; then
     AC_CACHE_CHECK([whether we can use epoll],i_cv_epoll_works,[
-      AC_TRY_RUN([
+      AC_TRY_LINK([
         #include <sys/epoll.h>
-    
+      ], [
         int main()
         {
   	return epoll_create(5) < 1;
--- a/m4/mmap_write.m4
+++ b/m4/mmap_write.m4
@@ -1,7 +1,7 @@
 dnl * If mmap() plays nicely with write()
 AC_DEFUN([DOVECOT_MMAP_WRITE], [
   AC_CACHE_CHECK([whether shared mmaps get updated by write()s],i_cv_mmap_plays_with_write,[
-    AC_TRY_RUN([
+    AC_TRY_LINK([
       #include <stdio.h>
       #include <sys/types.h>
       #include <sys/stat.h>
@@ -9,6 +9,7 @@ AC_DEFUN([DOVECOT_MMAP_WRITE], [
       #include <fcntl.h>
       #include <sys/mman.h>
       #include <string.h>
+    ], [
       int main() {
         /* return 0 if we're signed */
         int f = open("conftest.mmap", O_RDWR|O_CREAT|O_TRUNC, 0600);
--- a/m4/want_gssapi.m4
+++ b/m4/want_gssapi.m4
@@ -55,7 +55,7 @@ AC_DEFUN([DOVECOT_WANT_GSSAPI], [
   
   				# does the kerberos library support SPNEGO?
   				AC_CACHE_CHECK([whether GSSAPI supports SPNEGO],i_cv_gssapi_spnego,[
-  				  AC_TRY_RUN([
+  				  AC_TRY_LINK([
   				    #ifdef HAVE_GSSAPI_H
   				    #  include <gssapi.h>
   				    #else
@@ -63,6 +63,7 @@ AC_DEFUN([DOVECOT_WANT_GSSAPI], [
   				    #endif
   				    #include <krb5.h>
   				    #include <string.h>
+  				  ], [
   				    int main(void) {
   				      OM_uint32 minor_status;
   				      gss_OID_set mech_set;
